FROM nvidia/cuda:10.2-cudnn7-devel-ubuntu16.04
MAINTAINER root
ENV BUILD_HOME /model_measuring
COPY . $BUILD_HOME

# Change the repo
RUN echo "" > /etc/apt/sources.list; echo "deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse" >> /etc/apt/sources.list; echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse" >> /etc/apt/sources.list; echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse" >> /etc/apt/sources.list; echo "deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse" >> /etc/apt/sources.list
 
#RUN apt-key adv --recv-keys --keyserver.ubuntu.com F60F4B3D7FA2AF80

RUN apt-get update && apt-get -y install wget curl zip && apt-get clean && rm -rf /var/lib/apt/lists/* 

RUN echo 'Anaconda install start'

RUN wget -P /tmp https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh && sha256sum /tmp/Anaconda3-2020.02-Linux-x86_64.sh \
&& bash /tmp/Anaconda3-2020.02-Linux-x86_64.sh -b -p /root/anaconda3 

ENV PATH /root/anaconda3/bin:$PATH

RUN conda init bash && conda update -n base -c defaults conda

RUN /bin/bash -c "source ~/.bashrc"

ADD environment.yml /tmp/environment.yml

RUN conda env create -f /tmp/environment.yml

RUN /bin/bash -c "source /root/anaconda3/bin/activate pytorch_1_3"
